﻿using Microsoft.Extensions.DependencyInjection;
using System;

namespace Xman.Dapper.Oracle
{
    public static class DapperServiceCollectionExtensions
    {
        public static IServiceCollection AddDapperContext<T, K>(this IServiceCollection services, Action<K> setupAction) where T : OracleContext where K : OracleContextOptions
        {
            if (setupAction != null)
            {
                services.Configure(setupAction);
            }
            services.AddSingleton<T>();
            return services;
        }
    }
}
